package com.haiertvbic.umwcloudpop.breceiver;

import java.util.Timer;
import java.util.TimerTask;

import com.haiertvbic.umwcloudpop.UMWCloudPOP;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class BootReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(final Context context, Intent intent) {

		if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED")){
			Timer timer = new Timer();
			timer.schedule(new TimerTask() {
				
				@Override
				public void run() {
					Intent startIntent = new Intent();
					startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
					startIntent.setClass(context, UMWCloudPOP.class);
					context.startActivity(startIntent);
					
				}
			}, 1000*60);
		}
		if(intent.getAction().equals("android.intent.action.MEDIA_MOUNTED")){
			Intent startIntent = new Intent();
			startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			startIntent.setClass(context, UMWCloudPOP.class);
			context.startActivity(startIntent);
		}
	}
}
